class Layer {
  msg = "";
  ele = "";
  time = "";
  constructor(msg, time = 3000) {
    this.msg = msg;
    this.time = time
    this.ele = document.createElement("div");
    this.ele.style.position = "fixed";
    this.ele.style.left = "50%";
    this.ele.style.top = "50%";
    this.ele.style.transform = "translate(-50%, -50%)";
    this.ele.style.zIndex = 100000;
    this.ele.style.padding = '0.6em 1em';
    this.ele.style.fontSize = '1em';
    this.ele.innerText = this.msg;
    this.ele.style.maxWidth = "80%";
    this.ele.style.borderRadius = "5px";
    this.ele.style.background = "rgba(0, 0, 0, 0.8)";
    this.ele.style.color = "#fff";
    this.ele.style.boxSizing = "border-box";
    document.body.appendChild(this.ele);
    setTimeout(() => {
      this.close()
    }, this.time)
  }
  close() {
    this.ele.remove();
  }
}
export default Layer